<?php
$INCLUDE_PATH= './';

require_once($INCLUDE_PATH .'include/WebService2Db.php');
require_once($INCLUDE_PATH .'include/util/GeoCodeUtil.php');
class FeedbackModel{
  static $vedioTable="cc8_vedio_feedback";
  static $cvshopTable="cvshop_feedback";
  static $vedioView="cc8_vedio_feedback_view";

  public static function ws(){
    return new WebService2Db();
  }
  public static function  getVedioFeedbackList($filter,$page,$size){
    return self::getFeedbackList(self::$vedioTable,$filter,$page,$size);
  }

  public static  function getVedioFeedbackViewList($filter,$page,$size){
    return self::getFeedbackList(self::$vedioView,$filter,$page,$size);
  }

  public static function executeVedioFeedback($feedback,$id=null){
    return self::executeFeedback(self::$vedioTable,$feedback,$id); 

  }
  
  public static function executeCvshopUser($feedback,$id=null){
    return self::executeFeedback(self::$cvshopTable,$feedback,$id); 

  }

  public static function executeOrigId(){
    $ws=self::ws();
    $res=$ws->oneSourceAutoExecute(self::$cvshopTable,array(array('orig_id','last_insert_id()',false)),'update','id=last_insert_id()');
    
  
  } 

  public static function executeFeedback($table,$feedback,$id=null){
    if($id){
      $method="update";
      $filter=array("id=".$id);
    }else{
      $method="insert";
    }
    $ws=self::ws();
    $res=$ws->oneSourceAutoExecute($table,$feedback,$method,$filter);
    return $res; 

  }

  public static  function getFeedbackList($table,$filter,$page,$size){

    $ws=self::ws();

    
    $ws->buildRequestParameter($table, "select", "*",
    "data_list",$filter ,"create_time desc", NULL, ($page-1)*$size, $size);

    $ws->buildRequestParameter($table, "select", "id", "data_count", $filter, NULL, NULL, NULL, NULL, true);   
    
    $res=$ws->getAll();
    return $res;

  }
  

}

?>
